home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 40
/
Amiga Format CD40 (1999-05-11)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-06].iso
/
-readerstuff-
/
paul_qureshi
/
source
/
nbody.lzx
/
NBody_Collision_Detection
/
project
/
top.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-03-27
|
841b
|
40 lines
#include <stdio.h>
#include <math.h>
#define PI 3.141592653589793
main()
{
int n, m, i=0; /* loop counter */
double x, y, z; /* coordinates */
FILE *fpr;
fpr = fopen("top.dat", "w");
fprintf(fpr, "polyhedron top\n");
fprintf(fpr, "n0 0 0 3.01\n");
for(m=0; m<32; m++) {
x = 2*cos(m*PI/16.0);
y = 2*sin(m*PI/16.0);
z = 0;
fprintf(fpr, "n01.m%02d %2.14f %2.14f %2.14f\n", m,x,y,z);
}
fprintf(fpr, "n2 0 0 -0.01\n");
fprintf(fpr, "*\n");
for (m=0; m<32; m++)
fprintf(fpr, "f%03d n0 n01.m%02d n01.m%02d\n",i++, m, (m+1)%32);
for (m=0; m<32; m++)
fprintf(fpr, "f%03d n2 n01.m%02d n01.m%02d\n",i++, (m+1)%32, m);
fprintf(fpr, "*\n");
fclose(fpr);
}